
#include "member_BListItem.h"
#include "member_BListWidget.h"

using namespace BWE;

member_BListItem::member_BListItem(BListItem* item)
{
	boss = 0;
	list = 0;
	align = Align_Left;
	selected = false;
	visible = false;
	dirty = true;
}
member_BListItem::~member_BListItem()
{

}

void member_BListItem::dirtyCell()
{
	if (list)
	{
		dirty = true;
		list_member(list)->dirtyArea = true;
		list->fresh();
	}
}

void member_BListItem::setHost(BListWidget* listWidget)
{
	if (list != listWidget)
	{
		BThingHolder holder = boss;
		if (list)
			list->removeItem(boss);
		list = listWidget;
	}
}
void member_BListItem::adjust()
{
	int y = rect.y();
	int h = rect.height();
	imageRect.set(rect.x(), y, h, h);
	BRect textArea = rect;
	textArea.left() = imageRect.right();
	textRect = textArea.align(align, textSize);
	textRect.right() = rect.right();
}
